{% extends "stocksys/base/base_page.html" %}
{% load staticfiles %}
{% block content %}
    <div class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="card">
                        <div class="content">
                            <h4 class="title">{{ title }}</h4>
                            <div class="toolbar">
                                <!--        Here you can write extra buttons/actions for the toolbar              -->
                            </div>
                            <div class="material-datatables">
                                <table class="table">
                                    <thead>
                                    <tr>
                                        <th class="text-center ">数据</th>
                                        <th class="text-center ">任务最近一次开始时间</th>
                                        <th class="text-center ">任务最近一次结束时间</th>
                                        <th class="text-center ">任务进度</th>
                                        <th class="text-center ">任务执行状态</th>
                                        <th class="text-center ">任务耗时</th>
                                        <th class="text-center ">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for task in update_tasks %}
                                        <tr>
                                            <td class="text-center ">{{ task.task_name }}</td>
                                            <td class="text-center ">{{ task.update_start_time | date:'Y-m-d H:i:s' }}</td>
                                            <td class="text-center ">{{ task.update_end_time| date:'Y-m-d H:i:s' }}</td>
                                            <td class="text-center ">{{ task.task_schedule | floatformat:3 }}%</td>
                                            {% ifequal  task.task_state False %}
                                                <td class="text-center danger">停止</td>
                                            {% else %}
                                                {% ifequal task.task_result "error" %}
                                                    <td class="text-center warning">异常</td>
                                                {% else %}
                                                    <td class="text-center success">运行中</td>
                                                {% endifequal %}
                                            {% endifequal %}
                                            <td class="text-center ">{{ task.task_cost | date:'H:i:s' }}</td>
                                            <td class="text-center ">
                                                <a href="{% url 'stocksys:data_update_action' id=task.id %}"
                                                   rel="tooltip" title="更新数据"
                                                   class="btn btn-success btn-simple btn-xs">
                                                    <i class="ti-cloud-up">更新</i>
                                                </a>
                                            </td>
                                        </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <!-- end content-->
                    </div>
                    <!--  end card  -->
                </div>
                <!-- end col-md-12 -->
            </div>
        </div>
    </div>
{% endblock %}
{% block pagescript %}
{% endblock %}

